package com.lincoln.jenkins.test.actions;

import com.lincoln.jenkins.test.replys.Reply;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

/// 从通讯录中删除好友/恢复好友(删除对方后可以用此接口再添加对方)
/// 群聊使用此接口可以保存到通讯录
/// <param name="wxid">wxid</param>
/// <param name="delete"></param>
@Data
@NoArgsConstructor
@AllArgsConstructor
public class DeleteFriend implements Reply {
    private String wxid;
    private boolean delete;

    public static DeleteFriend deleteFriend(String wxid) {
        DeleteFriend deleteFriend = new DeleteFriend();
        deleteFriend.setWxid(wxid);
        deleteFriend.setDelete(true);
        return deleteFriend;
    }

    public static DeleteFriend addFriend(String wxid) {
        DeleteFriend deleteFriend = new DeleteFriend();
        deleteFriend.setWxid(wxid);
        deleteFriend.setDelete(false);
        return deleteFriend;
    }

    @Override
    public String genUrl() {
        return "<&&>DeleteFriend<&>" + wxid + "<&>" + delete;
    }
}
